//
//  DCMineTableViewCell.m
//  JiuyaoMotorcade
//
//  Created by 大橙子 on 2018/11/29.
//  Copyright © 2018 Tomous. All rights reserved.
//

#import "DCMineTableViewCell.h"

@implementation DCMineTableViewCell

+(instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *CellID = @"Cell";
    DCMineTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID];
    if (cell == nil) {
        cell = [[DCMineTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.titleImageView = [[UIImageView alloc]init];
        //        self.titleImageView.backgroundColor = [UIColor redColor];
        [self addSubview:self.titleImageView];
        
        self.titleLabel = [[UILabel alloc]init];
        //        self.titleLabel.backgroundColor = [UIColor cyanColor];
        self.titleLabel.font = FONT(17);
        [self addSubview:self.titleLabel];
        
        self.subLabel = [[UILabel alloc]init];
        //        self.subLabel.backgroundColor = [UIColor yellowColor];
        self.subLabel.textColor = [UIColor lightGrayColor];
        self.subLabel.font = FONT(14);
        self.subLabel.textAlignment = NSTextAlignmentRight;
        self.subLabel.numberOfLines = 0;
        [self addSubview:self.subLabel];
        
        self.pointImage = [[UIImageView alloc]initWithImage:IMAGENAME(@"箭头")];
        //        self.pointImage.backgroundColor = [UIColor cyanColor];
        [self addSubview:self.pointImage];
    }
    return self;
}

-(void)layoutSubviews {
    [super layoutSubviews];
    self.titleImageView.frame = CGRectMake(10, (self.height - 25)/2, 25, 25);
    self.titleLabel.frame = CGRectMake(self.titleImageView.right+10, 0, self.width/2 - 30, self.height);
    __weak typeof(self) weakself = self;
    [self.subLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakself);
        make.bottom.equalTo(weakself);
        make.left.equalTo(weakself.titleLabel.mas_right).offset(5);
        make.right.equalTo(weakself.mas_right).offset(-35);
    }];
    
    self.pointImage.size = CGSizeMake(18, 18);
    self.pointImage.y = (self.height - self.pointImage.height)/2;
    self.pointImage.x = self.width - self.pointImage.width - 10;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}


@end
